<template>
  <div class="settings">
    <el-row :gutter="20">
      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>System Settings</span>
            </div>
          </template>
          <el-form :model="systemSettings" label-width="120px">
            <el-form-item label="Site Name">
              <el-input v-model="systemSettings.siteName" />
            </el-form-item>
            <el-form-item label="Site Description">
              <el-input v-model="systemSettings.siteDescription" type="textarea" />
            </el-form-item>
            <el-form-item label="Maintenance Mode">
              <el-switch v-model="systemSettings.maintenanceMode" />
            </el-form-item>
            <el-form-item label="Registration">
              <el-switch v-model="systemSettings.allowRegistration" />
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="saveSystemSettings">Save Changes</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </el-col>

      <el-col :span="12">
        <el-card>
          <template #header>
            <div class="card-header">
              <span>User Preferences</span>
            </div>
          </template>
          <el-form :model="userPreferences" label-width="120px">
            <el-form-item label="Theme">
              <el-radio-group v-model="userPreferences.theme">
                <el-radio label="light">Light</el-radio>
                <el-radio label="dark">Dark</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="Language">
              <el-select v-model="userPreferences.language">
                <el-option label="English" value="en" />
                <el-option label="中文" value="zh" />
                <el-option label="Español" value="es" />
              </el-select>
            </el-form-item>
            <el-form-item label="Notifications">
              <el-switch v-model="userPreferences.emailNotifications" />
              <span class="setting-description">Email notifications</span>
            </el-form-item>
            <el-form-item label="Timezone">
              <el-select v-model="userPreferences.timezone">
                <el-option label="UTC" value="UTC" />
                <el-option label="GMT+8" value="GMT+8" />
                <el-option label="EST" value="EST" />
              </el-select>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="saveUserPreferences">Save Preferences</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
import { reactive } from 'vue'
import { ElMessage } from 'element-plus'

const systemSettings = reactive({
  siteName: 'Admin System',
  siteDescription: 'A powerful admin system built with Vue 3',
  maintenanceMode: false,
  allowRegistration: true
})

const userPreferences = reactive({
  theme: 'light',
  language: 'en',
  emailNotifications: true,
  timezone: 'UTC'
})

const saveSystemSettings = () => {
  // Here you would typically make an API call
  ElMessage.success('System settings saved successfully')
}

const saveUserPreferences = () => {
  // Here you would typically make an API call
  ElMessage.success('User preferences saved successfully')
}
</script>

<style scoped>
.settings {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.setting-description {
  margin-left: 10px;
  color: #909399;
  font-size: 14px;
}

.el-form {
  max-width: 500px;
}
</style> 